Repository navigation
fix: recover the Grok bridge from a deleted task folder and a second connector - #9
Merged
Merged
Conversation
A node whose default task folder (`<data-dir>/../tasks`) was deleted, for example by a machine migration, refused to start with "node policy is invalid at workspace". That folder belongs to the node, so startup now makes it again. A missing custom workspace still fails startup, and the error now names the path and the reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A client can start the stdio connector more than once, for example to list tools on a second connection. The second bridge found the runtime lock held and exited with "Node runtime is locked", so tool calls failed. The first bridge now owns the node and serves the executor tools on `grokbot-bridge/bridge.sock`. Later bridges forward their calls to it. The owner keeps the node while any connector uses it, and a remaining connector takes over when the owner exits. The lock records the owner and node process IDs, so a lock left by a crashed bridge is taken over; on Linux its orphaned node is stopped first. "Local Aether node exited" now ends with the node's last stderr line and its exit status, so the real cause reaches the client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
After the box migration on Nov 10 deleted
/home/box/.aether/tasks, the Grok Bot connector on 0.3.0 stopped working, and it failed in two ways. First, the node refused to start withnode policy is invalid at workspace. Second, after the folder was made again by hand, the app's second connector process exited withNode runtime is locked, so every tool call failed.What changes
stateDiagram-v2 [*] --> Acquire: connector process starts Acquire --> Owner: lock is free / lock owner pid is dead (take over) Acquire --> Proxy: lock owner answers on bridge.sock Acquire --> Retry: owner still starting Retry --> Acquire: after 250 ms Retry --> Failed: 10 s and no answer (error names the pid) Owner --> Owner: proxies connect and disconnect Owner --> [*]: own client closed and no proxies, or node exited (error ends with node's last stderr line) Proxy --> Acquire: owner went away Proxy --> [*]: own client closedBefore: the only path was "lock is free → own the node", and every other path ended in
Node runtime is locked.node_builder.rs): if the policy workspace is missing and it is the default<data-dir>/../tasksfolder, startup makes the folder again. A missing custom workspace still fails startup, but the error now readsnode policy workspace <path> cannot be opened (entity not found); ….runtime.lock/owner.jsonrecords the bridge and node pids. When a stale lock's orphaned node is still running, the new bridge stops it only after/proc/<pid>/cmdlineconfirms that the process isservefor this data directory. Otherwise the error names the pid. An empty lock left by a 0.3.0 bridge is still reported rather than removed, because its owner cannot be identified.Local Aether node exited (code N): <last stderr line>.Look at:
integrations/grokbot-bridge/src/runtime.mjs: the lock takeover (rename, then re-check the owner) and the owner/proxy protocol.Evidence
mise run fmt: passes.mise run lint(clippy 1.98): passes.cargo test -p aether --lib node_builder: 20 passed, including 2 new tests: a deleted default task folder is made again, and a missing owner workspace fails startup with an error that names its path.npm testinintegrations/grokbot-bridge: 15 passed. The 7 new tests intest/runtime.test.mjscover forwarding and taking over, stale-lock takeover, stopping an orphaned node, never signalling an unrelated pid, unrecorded and unanswering locks, the exit message with the node's stderr line, and two real stdio connectors sharing one fake node, where the second restarts the node after the first closes. The runtime tests passed 3 times in a row.cargo test --workspace:agent::codex::tests::{app_server_time_limit_covers_the_full_turn, dropping_a_session_stops_the_commands_the_app_server_started}and 3–4 timing-sensitive feature scenarios (outbox.feature:15,replay-and-overload.feature:20,task-lifecycle.feature:12/29) fail. They fail on a cleanmainworktree on this machine too, where the fake agent finishes before the "running" check. They are unrelated to this change.Merge danger
Door: two-way
Blast radius: one node
The node change only affects startup when the workspace is missing. The bridge is experimental and runs from a source checkout. A 0.3.0 bridge that is still running holds an empty lock that the new code will not take over, so the box must restart the connector after updating.
After merge
workflow_dispatch).🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.